# _*_ coding: utf-8 _*_
from odoo import models, fields, api


class StockQuant(models.Model):
    _inherit = "stock.quant"

    move_picking_id = fields.Many2one("stock.picking", related="reservation_id.picking_id", readonly=True,
                                      string=u"预留调拨单号")
    move_origin = fields.Char(related="reservation_id.origin", readonly=True, string=u"预留单号/工单号")
    lot_ref = fields.Char(related="lot_id.ref", store=True, readonly=True)

    @api.model
    def delete_zero_quant(self):
        self.env.cr.execute("delete from stock_quant where qty < 0.01")
        return True
